package com.qf.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 接收请求参数的对象
 * @author zjw
 * @description
 * @date 2021/10/8$ 11:32$
 */
public class UserDTO {

    /**
     * 不为null并且不为""
     */
    @NotBlank(message = "name为必传项，岂能为空！")
    private String name;

    /**
     * 不为null
     */
    @NotNull(message = "age为必传项，岂能为空！")
    @Min(value = 18,message = "18禁！")
    @Max(value = 65,message = "65退休！")
    private Integer age;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "birthday为必传项，岂能为空！")
    private Date birthday;

    @Override
    public String toString() {
        return "UserDTO{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", birthday=" + birthday +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
}
